home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / osr5 / sco / scripts / mail / mailq < prev    next >
Encoding:
Text File  |  1997-08-26  |  1.2 KB  |  48 lines

  1. :
  2. # @(#) mailq.sh 1.0 92/09/20
  3. # 90/11/04 john h. dubois iii (john@armory.com)
  4. # 92/02/16 added help, added output formatting
  5. # 92/09/20 Better formatting
  6.  
  7. if [ $# -gt 0 ]; then
  8.     echo \
  9. "$0: list mail in MMDF & UUCP queues.
  10. $0 tells how many messages are waiting for delivery by the MMDF mail system,
  11. and prints information on mail waiting for delivery by the UUCP system.
  12. For each UUCP rmail job, $0 prints the size of the message in bytes,
  13. the date the job was submitted or refreshed, and the recipient."
  14.     exit 0
  15. fi
  16.  
  17. echo "Mail waiting for processing by MMDF:"
  18. /usr/mmdf/bin/checkque -z | egrep -v 'queued|Kbytes|^$'
  19.  
  20. echo "\nMail waiting for delivery by UUCP:"
  21. /usr/bin/uustat -a | awk '
  22. BEGIN {
  23.     Format = "%-11s %7s  %s\n"
  24.     printf Format,"Job Date","Size","Recipients"
  25. }
  26.  
  27. /^[ \t]/ {
  28.     if ($5 == "rmail") {
  29.     if ($3 != sysname)
  30.         size = "?"
  31.     sysname = $3
  32.     recipients = ""
  33.     # Do not prepend UUCP system name if the address includes a domain
  34.     for (i = 6; i <= NF; i++)
  35.         if ($i !~ /\..*!/)
  36.         recipients = recipients sysname "!" $i " "
  37.         else
  38.         recipients = recipients $i " "
  39.     sub("-"," ",$1)
  40.     printf Format,$1,size,recipients
  41.     }
  42. }
  43. {
  44.     sysname = $4
  45.     size = $6
  46. }
  47. '
  48.